<?php  if (!defined("IS_INITPHP")) exit("Access Denied!");  /* INITPHP Version 1.0 ,Create on 2016-08-31 21:53:11, compiled from D:\chendeben\zendwork\kabasi/app/template/kabasi/manage/login.html */ ?>
<!DOCTYPE html>
<html>
<head>
<title>后台登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="" type="image/x-icon" />
<link href="/adminlte/bootstrap/css/bootstrap.min.css"  rel="stylesheet" type="text/css">
<script type="text/javascript" src="/adminlte/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script type="text/javascript" src="/adminlte/bootstrap/js/bootstrap.min.js"></script> 
</head>
<body>
    <div class="navbar navbar-default navbar-static-top">
      <div class="container">
        <div class="navbar-header">
          <a class="navbar-brand" href="/index/index" draggable="true">后台登陆</a>
        </div>
      </div>
    </div>
   <div class="container">
      <div class="row">
        <div style="width:400px;margin:20px auto 0 auto;">
          <div class="panel panel-primary">
            <div class="panel-heading">
              <h3 class="panel-title">后台登录</h3>
            </div>
            <div class="panel-body">
              <form id="login_form" method="post" >
                <div class="form-group" style="height:30px;">
                  <div class="col-sm-12 col-xs-12">
                      <input placeholder="用户名" id="field_username" name="username" class="form-control" type="text" title="用户名" value="" autocomplete="off">
                  </div>
                </div>
                <div class="form-group" style="height:30px;">
                  <div class="col-sm-12 col-xs-12">
                    <input placeholder="密码" id="field_password" name="password" class="form-control" type="password" title="密码" value="" autocomplete="off">
                  </div>
                </div>
                <div class="form-group" style="height:30px;">
                  <div class="col-sm-6 col-xs-6">
                      <input placeholder="验证码" id="field_verify" name="validcode" class="form-control" type="text"  title="验证码" value="" autocomplete="off">
                  </div>
                  <div class="col-sm-6  col-xs-6">
                       <img id="verify_img" src="/manage/login/validcode?code=<?php echo uniqid();  ?>" onclick="this.src='/manage/login/validcode?code='+Math.random();" class="cursor">
                  </div>                    
                </div>                  
                <div class="form-group" style="height:30px;">
                  <div class="col-sm-12  col-xs-12">
                        <input type="hidden" name="do" value="login"> 
                        <button type="button" class="btn btn-primary col-sm-12" href="javascript:void();" id="btn_login">登录</button>
                  </div>
                </div>
             </form>
            </div>
          </div>
        </div>
      </div>
    </div>
<script type="text/javascript">
 $('#btn_login').on('click',function(){
      $.post('/manage/login/login',$('#login_form').serialize(),function(data){
           if( data.status==1 ){
                window.location.href="/manage";
           }else{
               alert(data.message);
               $('#verify_img').attr('src','/manage/login/validcode?code='+Math.random());
           }
      },'json'); 
 });
  $('#field_username,#field_password,#field_verify').on('keypress',function(e){
      var  keycode =  e.which || window.event.keyCode;
      if( keycode==13 ){
          $('#btn_login').trigger('click');
      }
 });
</script>
</body>
</html>